<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\SmsCode;
/* @var $this yii\web\View */
/* @var $searchModel common\models\SmsCodeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '验证码管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="sms-code-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('创建验证码', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'tableOptions' => ['class' => 'table table-striped table-bordered','style'=>'width:auto;max-width:none;'],
        'options' => ['class' => 'grid-view','style'=>'overflow:auto'],
        'columns' => [
            

            'id',
            'relation',
            //'code_type',
             [
                'attribute' => 'code_type',
                'value' => function ($model, $key, $index, $column) {
                    return SmsCode::itemAlias("code_type", $model->code_type);
                },
                'filter'=>SmsCode::itemAlias("code_type"),
            ],   
            'verify_code',
            'expiration_time',
            // 'is_used',
             [
                'attribute' => 'is_used',
                'value' => function ($model, $key, $index, $column) {
                    return SmsCode::itemAlias("is_used", $model->is_used);
                },
                'filter'=>SmsCode::itemAlias("is_used"),
            ],
            // 'error_count',
            // 'create_time',
            // 'ip',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
